//
//  AppContextTest.m
//  WJAppContext-example
//
//  Created by Yunhai.Wu on 15/11/2.
//  Copyright (c) 2015年 WJ. All rights reserved.
//

#import "AppContextTest.h"
#import "QWSession.h"
#import "GenericQWToken.h"
#import "QWAppContext.h"

@implementation AppContextTest

-(void) testStore {
    GenericQWToken *token = [[GenericQWToken alloc] init];
    [token setToken:@"token"];
    [token setRefreshToken:@"refreshToken"];
    [token setTimeout:[[NSDate date] timeIntervalSince1970] + 10000];
    [token setUid:@"uid"];
    [[QWSession sharedInstance] logined:token];
    GHTestLog(@"store success ..");
    
}

-(void) testDelete {
    [[QWSession sharedInstance] logout];
    GHTestLog(@"delete success ..");
}

-(void) testFetch {
    id<IQWToken> token = [[QWSession sharedInstance] getToken];
    if (token) {
        NSString *tokenJson = [QWJSON toJsonString:token];
        GHTestLog(@"tokenJson:%@",tokenJson);
    }
}

-(void)setUp {
    [QWAppContext registerApp];
}

-(void) testNotify {
    
}

@end
